<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
request.setAttribute("basePath", basePath);
String baseInfoJson= (String)request.getAttribute("baseInfoJson");
%>
<link rel="stylesheet" href="${basePath}assets/bootstrap/css/bootstrap.css"/>
<link rel="stylesheet" href="${basePath}assets/jquery-ui/jquery-ui.css"/>
<link rel="stylesheet" href="${basePath}assets/css/basic.css"/>
<link rel="stylesheet" href="${basePath}assets/css/medical_record/home_page.css"/>
<script type="text/javascript" src="${basePath}assets/js/jquery/jquery.min.js"></script>
<script type="text/javascript" src="${basePath}assets/bootstrap/js/bootstrap.js"></script>
<script type="text/javascript" src="${basePath}assets/jquery-ui/jquery-ui.js"></script>
<script  type="text/javascript" src="${basePath}/static/layer/layer.js"></script>
<link href="${basePath}/static/layer/layer_defined.css" rel="stylesheet" type="text/css">

<div style="padding:10px;">
        <input type="hidden" id="firstGuid" value="${firstGuid}">
		<a class="int" onclick="getInfo(1)">体温单</a>
		<a class="int" onclick="getInfo(2)">血糖测定</a>
		<a class="int" onclick="getInfo(3)">心电检测</a>
		<a class="int" onclick="getInfo(4)">生命体征观察</a>
</div>
<div id="content" style="overflow:auto;padding:10px 5%; height:800px;">

</div>

<script>
    getInfo(1);
	function getInfo(typeId){
		var url = "${basePath}medical_record/ajaxPdfPigeonhole";
		var dataform = {"firstGuid": $("#firstGuid").val(),"typeId":typeId};
		
		$.ajax({
		    type:"get",
		    url:url,
		    dataType:"json",
		    data:dataform,
		    beforeSend:function(){
		    	 $("#content").html("");
   	 	    },
		    success:function(result){
		    	
		    	 if(result.success){
		    		 var data = result.data;
			         var imgData = data.imgList;
			         var imgUrl = data.imgUrl;
			        
			         if (null != data && null != imgData && imgData.length > 0) {
			        	   var content = "";
			               $.each(imgData, function(i, item){
			            	     	content+="<img style='margin-bottom:20px;width:100%;' src="+ item +">";
			                });
			            	$("#content").html(content);
			        	} else {
			        		layer.alert("暂无数据",{icon:7});
			        		return;
			        	}
		    		 
		        	/*  var data = result.data;
		        	 var jsonStr=JSON.parse(data.jsonStr);
		        	 if(jsonStr==null){
		        		 layer.alert("暂无数据",{icon:7});
		        		 return;
		        	 }
		        	 if(!jsonStr.recordSheet){
	        			 layer.alert("暂无数据",{icon:7});
		        		 return;
	        		 }
		        	 var imgData=[];
		        	 if(typeId==1){//体温
		        		 imgData=jsonStr.recordSheet.temperatureRecord.imageFilePathList;
		        	 }else if(typeId==2){//血糖
		        		 imgData=jsonStr.recordSheet.bloodSugarRecord.imageFilePathList; 
		        	 }else if(typeId==3){//心电
		        		 imgData=jsonStr.recordSheet.electrocardiogramRecord.imageFilePathList; 
		        	 }else if(typeId==4){//生命体征
		        		 imgData=jsonStr.recordSheet.vitalSignRecord.imageFilePathList; 
		        	 }
		        	var imgUrl=data.imgUrl;
		        	
		             if (data != null&&imgData!=null&&imgData.length>0) {
		            	   var content = "";
		            	   $.each(imgData, function(i, item){
		            	     content+="<img style='margin-bottom:20px;width:100%;' src="+imgUrl+item+">";
		            	   });
		            	   $("#content").html("");
		            	   $("#content").html(content);
		               }else{
		            	   layer.alert("暂无数据",{icon:7});
		               }      */
		         }else{
		            layer.alert(result.msg,{icon:7});
		         }
		    },
		    error:function(XMLHttpRequest, textStatus, errorThrown) {
		          if(XMLHttpRequest.status == 403) {
		                 layer.alert("没有权限!",{icon:7});
		          }
		    } 
		}); 	
		
	}
</script>